'\" t
.\"     Title: dblink_error_message
.\"    Author: The PostgreSQL Global Development Group
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\"      Date: 2021
.\"    Manual: PostgreSQL 13.3 Documentation
.\"    Source: PostgreSQL 13.3
.\"  Language: English
.\"
.TH "DBLINK_ERROR_MESSAGE" "3" "2021" "PostgreSQL 13.3" "PostgreSQL 13.3 Documentation"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
dblink_error_message \- gets last error message on the named connection
.SH "SYNOPSIS"
.sp
.nf
dblink_error_message(text connname) returns text
.fi
.SH "DESCRIPTION"
.PP
\fBdblink_error_message\fR
fetches the most recent remote error message for a given connection\&.
.SH "ARGUMENTS"
.PP
\fIconnname\fR
.RS 4
Name of the connection to use\&.
.RE
.SH "RETURN VALUE"
.PP
Returns last error message, or
OK
if there has been no error in this connection\&.
.SH "NOTES"
.PP
When asynchronous queries are initiated by
\fBdblink_send_query\fR, the error message associated with the connection might not get updated until the server\*(Aqs response message is consumed\&. This typically means that
\fBdblink_is_busy\fR
or
\fBdblink_get_result\fR
should be called prior to
\fBdblink_error_message\fR, so that any error generated by the asynchronous query will be visible\&.
.SH "EXAMPLES"
.sp
.if n \{\
.RS 4
.\}
.nf
SELECT dblink_error_message(\*(Aqdtest1\*(Aq);
.fi
.if n \{\
.RE
.\}
